<!DOCTYPE html>
<html>
  <head>
    <title>管理员功能登录</title>
    <link rel="stylesheet" href="css/login.css" type="text/css" media="screen">
	<meta charset="utf-8">
    <meta name="content-type" content="text/html; charset=UTF-8">
    <script type="text/javascript" src="js/jquery-1.12.3.min.js"></script>
    <script type="text/javascript">
    	$(function(){
    		$("#loginButton").click(function(){
    			$.ajax({url:"Admin.action",type:"POST",data:$("#loginForm").serialize(),
    				success:function(msg){
    					if(msg.success==true){
    						window.location.reload();
    					}else{
    						$("#msg").text("你密码错了(刘伟东的微笑)").css("color","red");
    					}
    				}
    			});
    		});
    		$("#registerButton").click(function(){
    			$.ajax({url:"Register.action",type:"POST",data:$("#registerForm").serialize(),
    				success:function(msg){
    					if(msg.success==true){
    						alert("注册成功，登录Id为："+msg.userId);
    					}else{
    						$("#msg").text("注册莫名其妙就失败了(刘伟东的微笑)").css("color","red");
    					}
    				}
    			});
    		});
    		$("#changeDiv").click(function(){
    			var divShow=$(".change[isShow=true]");
    			var divNotShow=$(".change[isShow=false]");
    			divShow.attr("isShow","false").hide();
    			divNotShow.attr("isShow","true").show();
    		});
    	});
    </script>
  </head>
  
  <body>
    <div class="main">
    	<div id="changeDiv" style="cursor: pointer;position:fixed;top:10px;right:100px;border-radius: 10px;background:white"><h2 id="adminLorR" style="text-align: center;font-size: 2em;margin:10px;color: #5296AB;font-family: 'PT Sans Narrow', sans-serif;">注册</h2></div>
		<div id="loginDiv" class="change" isShow="true">
			<div class="login">
				<img class="login-top" style="background:transparent;padding:0px;width:100px;top:-50px;margin:auto;" src="img/p.png">
				<h1>管理员 登录</h1>
				<div class="login-bottom">
					<form id="loginForm" action="Admin.action" method="post">
						<input name="id" type="text" placeholder="用户名">					
						<input name="pwd" type="password" class="password" placeholder="密码">						
						<input id="loginButton" type="button" value="登录">
					</form>
					<a href="#"><p id="msg">忘记密码？怪我咯</p></a>
				</div>
			</div>
			<div class="footer">
				<p>管理员功能需要先登录</p>
			</div>
		</div>
		<div id="registerDiv" class="change" isShow="false" style="display:none;">
			<div class="login">
				<img class="login-top" style="background:transparent;padding:0px;width:100px;top:-50px;margin:auto;" src="img/p.png">
				<h1>管理员 注册</h1>
				<div class="login-bottom">
					<form id="registerForm" action="Register.action" method="post">
						<input name="userName" type="text" placeholder="昵称">					
						<input name="pwd" type="password" class="password" placeholder="密码">						
						<input id="registerButton" type="button" value="注册">
					</form>
				</div>
			</div>
		</div>
	</div>
	
  </body>
</html>